package com.buka.config;

import com.buka.interceptor.LoginUserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Resource
    LoginUserInterceptor loginUserInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginUserInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/api/user/v1/register","/api/user/v1/login",
                "/api/notify/v1/*","/api/coupon/v1/new_user_coupon","/api/productOrder/v1/queryState",
                        "/api/stock/v1/reduce", "/api/couponTask/v1/lockCoupon","/error");

    }
}
